"""
@author: jiangpj
@email: pj.jiang@hzgosun.com
@file: userRoleManagePage.py
@time: 2019/5/24 11:32

后台角色的增删改查自动化测试用例编写

"""
from common.poium import Page
from common.vue.button import VueButton
from common.vue.float_window import FloatWindow
from common.vue.label import ElementBaseLabel
from common.vue.label import ElementType as ET
from common.vue.search import VueSearch
from common.vue.table import VueTable, VueTurnPage
from common.vue.tree import VueBoxTree


class SearchTools(VueSearch):
    """查询区域"""

    number = ElementBaseLabel(ET.INPUT, label="角色名称")
    search_btn = VueButton("检索")   # 查询按钮

    def __init__(self):
        super(SearchTools, self).__init__()


class Table(VueTable):
    """人口表"""

    add_btn = VueButton("新建")

    def __init__(self):
        super(Table, self).__init__()


class AddPersonWindow(FloatWindow):
    """添加弹窗"""
    idname = ElementBaseLabel(ET.INPUT, label="角色名称")
    page_role = VueBoxTree(index=0)

    def __init__(self, title=None, index=None):
        super(AddPersonWindow, self).__init__(title=title, index=index)


class ModiyPersonWindow(AddPersonWindow):
    """修改人口信息弹窗"""
    page_role = VueBoxTree(index=1)

    def __init__(self, title=None, index=None):
        super(ModiyPersonWindow, self).__init__(title=title, index=index)


class UserRole(Page):
    searchTools = SearchTools()      # 查询区域
    table = Table()  # 列表
    turnPage = VueTurnPage()  # 翻页
    addUserRole = AddPersonWindow(index=1)
    modifyUserRole = ModiyPersonWindow(title='角色编辑')  # 修改人口弹窗
